Support for NXP's i.MX8QM SoC
authorAnson Huang <[email protected]>
Mon, 11 Jun 2018 04:54:05 +0000 (12:54 +0800)
committerAnson Huang <[email protected]>
Tue, 19 Jun 2018 02:24:32 +0000 (10:24 +0800)
NXP's i.MX8QM is an ARMv8 SoC with 2 clusters, 2 Cortex-A72
cores in one cluster and 4 Cortex-A53 in the other cluster,
and also has system controller (Cortex-M4) inside, documentation
can be found in below link:

https://www.nxp.com/products/processors-and-microcontrollers/
applications-processors/i.mx-applications-processors/i.mx-8-processors:IMX8-SERIES

This patch adds support for booting up SMP linux kernel (v4.9).

Signed-off-by: Anson Huang <[email protected]>
docs/plat/imx8.rst
plat/imx/common/include/imx8qm_pads.h [new file with mode: 0644]
plat/imx/imx8qm/imx8qm_bl31_setup.c [new file with mode: 0644]
plat/imx/imx8qm/imx8qm_psci.c [new file with mode: 0644]
plat/imx/imx8qm/include/platform_def.h [new file with mode: 0644]
plat/imx/imx8qm/include/sec_rsrc.h [new file with mode: 0644]
plat/imx/imx8qm/platform.mk [new file with mode: 0644]

index a56d0f14abcfcd19f4998fa5c52eb352f7664ad2..42409623df7e5c0c2f2c928d049135bccf852ec9 100644 (file)
@@ -9,6 +9,9 @@ Cortex-A35, and Cortex-M4 based solutions for advanced graphics,
 imaging, machine vision, audio, voice, video, and safety-critical
 applications.
 
+The i.MX8QM is with 2 Cortex-A72 ARM core, 4 Cortex-A53 ARM core
+and 1 Cortex-M4 system controller.
+
 The i.MX8QX is with 4 Cortex-A35 ARM core and 1 Cortex-M4 system
 controller.
 
@@ -39,6 +42,7 @@ Build Procedure
 
        CROSS_COMPILE=aarch64-linux-gnu- make PLAT=<Target_SoC> bl31
 
+   Target_SoC should be "imx8qm" for i.MX8QM SoC.
    Target_SoC should be "imx8qx" for i.MX8QX SoC.
 
 Deploy TF-A Images
diff --git a/plat/imx/common/include/imx8qm_pads.h b/plat/imx/common/include/imx8qm_pads.h
new file mode 100644 (file)
index 0000000..6107bd9
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*!
+ * Header file used to configure SoC pad list.
+ */
+
+#ifndef SC_PADS_H
+#define SC_PADS_H
+
+/* Includes */
+
+/* Defines */
+
+/*!
+ * @name Pad Definitions
+ */
+/*@{*/
+#define SC_P_SIM0_CLK                            0     /* DMA.SIM0.CLK, LSIO.GPIO0.IO00 */
+#define SC_P_SIM0_RST                            1     /* DMA.SIM0.RST, LSIO.GPIO0.IO01 */
+#define SC_P_SIM0_IO                             2     /* DMA.SIM0.IO, LSIO.GPIO0.IO02 */
+#define SC_P_SIM0_PD                             3     /* DMA.SIM0.PD, DMA.I2C3.SCL, LSIO.GPIO0.IO03 */
+#define SC_P_SIM0_POWER_EN                       4     /* DMA.SIM0.POWER_EN, DMA.I2C3.SDA, LSIO.GPIO0.IO04 */
+#define SC_P_SIM0_GPIO0_00                       5     /* DMA.SIM0.POWER_EN, LSIO.GPIO0.IO05 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_SIM           6     /*  */
+#define SC_P_M40_I2C0_SCL                        7     /* M40.I2C0.SCL, M40.UART0.RX, M40.GPIO0.IO02, LSIO.GPIO0.IO06 */
+#define SC_P_M40_I2C0_SDA                        8     /* M40.I2C0.SDA, M40.UART0.TX, M40.GPIO0.IO03, LSIO.GPIO0.IO07 */
+#define SC_P_M40_GPIO0_00                        9     /* M40.GPIO0.IO00, M40.TPM0.CH0, DMA.UART4.RX, LSIO.GPIO0.IO08 */
+#define SC_P_M40_GPIO0_01                        10    /* M40.GPIO0.IO01, M40.TPM0.CH1, DMA.UART4.TX, LSIO.GPIO0.IO09 */
+#define SC_P_M41_I2C0_SCL                        11    /* M41.I2C0.SCL, M41.UART0.RX, M41.GPIO0.IO02, LSIO.GPIO0.IO10 */
+#define SC_P_M41_I2C0_SDA                        12    /* M41.I2C0.SDA, M41.UART0.TX, M41.GPIO0.IO03, LSIO.GPIO0.IO11 */
+#define SC_P_M41_GPIO0_00                        13    /* M41.GPIO0.IO00, M41.TPM0.CH0, DMA.UART3.RX, LSIO.GPIO0.IO12 */
+#define SC_P_M41_GPIO0_01                        14    /* M41.GPIO0.IO01, M41.TPM0.CH1, DMA.UART3.TX, LSIO.GPIO0.IO13 */
+#define SC_P_GPT0_CLK                            15    /* LSIO.GPT0.CLK, DMA.I2C1.SCL, LSIO.KPP0.COL4, LSIO.GPIO0.IO14 */
+#define SC_P_GPT0_CAPTURE                        16    /* LSIO.GPT0.CAPTURE, DMA.I2C1.SDA, LSIO.KPP0.COL5, LSIO.GPIO0.IO15 */
+#define SC_P_GPT0_COMPARE                        17    /* LSIO.GPT0.COMPARE, LSIO.PWM3.OUT, LSIO.KPP0.COL6, LSIO.GPIO0.IO16 */
+#define SC_P_GPT1_CLK                            18    /* LSIO.GPT1.CLK, DMA.I2C2.SCL, LSIO.KPP0.COL7, LSIO.GPIO0.IO17 */
+#define SC_P_GPT1_CAPTURE                        19    /* LSIO.GPT1.CAPTURE, DMA.I2C2.SDA, LSIO.KPP0.ROW4, LSIO.GPIO0.IO18 */
+#define SC_P_GPT1_COMPARE                        20    /* LSIO.GPT1.COMPARE, LSIO.PWM2.OUT, LSIO.KPP0.ROW5, LSIO.GPIO0.IO19 */
+#define SC_P_UART0_RX                            21    /* DMA.UART0.RX, SCU.UART0.RX, LSIO.GPIO0.IO20 */
+#define SC_P_UART0_TX                            22    /* DMA.UART0.TX, SCU.UART0.TX, LSIO.GPIO0.IO21 */
+#define SC_P_UART0_RTS_B                         23    /* DMA.UART0.RTS_B, LSIO.PWM0.OUT, DMA.UART2.RX, LSIO.GPIO0.IO22 */
+#define SC_P_UART0_CTS_B                         24    /* DMA.UART0.CTS_B, LSIO.PWM1.OUT, DMA.UART2.TX, LSIO.GPIO0.IO23 */
+#define SC_P_UART1_TX                            25    /* DMA.UART1.TX, DMA.SPI3.SCK, LSIO.GPIO0.IO24 */
+#define SC_P_UART1_RX                            26    /* DMA.UART1.RX, DMA.SPI3.SDO, LSIO.GPIO0.IO25 */
+#define SC_P_UART1_RTS_B                         27    /* DMA.UART1.RTS_B, DMA.SPI3.SDI, DMA.UART1.CTS_B, LSIO.GPIO0.IO26 */
+#define SC_P_UART1_CTS_B                         28    /* DMA.UART1.CTS_B, DMA.SPI3.CS0, DMA.UART1.RTS_B, LSIO.GPIO0.IO27 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIOLH        29    /*  */
+#define SC_P_SCU_PMIC_MEMC_ON                    30    /* SCU.GPIO0.IOXX_PMIC_MEMC_ON */
+#define SC_P_SCU_WDOG_OUT                        31    /* SCU.WDOG0.WDOG_OUT */
+#define SC_P_PMIC_I2C_SDA                        32    /* SCU.PMIC_I2C.SDA */
+#define SC_P_PMIC_I2C_SCL                        33    /* SCU.PMIC_I2C.SCL */
+#define SC_P_PMIC_EARLY_WARNING                  34    /* SCU.PMIC_EARLY_WARNING */
+#define SC_P_PMIC_INT_B                          35    /* SCU.DSC.PMIC_INT_B */
+#define SC_P_SCU_GPIO0_00                        36    /* SCU.GPIO0.IO00, SCU.UART0.RX, LSIO.GPIO0.IO28 */
+#define SC_P_SCU_GPIO0_01                        37    /* SCU.GPIO0.IO01, SCU.UART0.TX, LSIO.GPIO0.IO29 */
+#define SC_P_SCU_GPIO0_02                        38    /* SCU.GPIO0.IO02, SCU.GPIO0.IOXX_PMIC_GPU0_ON, LSIO.GPIO0.IO30 */
+#define SC_P_SCU_GPIO0_03                        39    /* SCU.GPIO0.IO03, SCU.GPIO0.IOXX_PMIC_GPU1_ON, LSIO.GPIO0.IO31 */
+#define SC_P_SCU_GPIO0_04                        40    /* SCU.GPIO0.IO04, SCU.GPIO0.IOXX_PMIC_A72_ON, LSIO.GPIO1.IO00 */
+#define SC_P_SCU_GPIO0_05                        41    /* SCU.GPIO0.IO05, SCU.GPIO0.IOXX_PMIC_A53_ON, LSIO.GPIO1.IO01 */
+#define SC_P_SCU_GPIO0_06                        42    /* SCU.GPIO0.IO06, SCU.TPM0.CH0, LSIO.GPIO1.IO02 */
+#define SC_P_SCU_GPIO0_07                        43    /* SCU.GPIO0.IO07, SCU.TPM0.CH1, SCU.DSC.RTC_CLOCK_OUTPUT_32K, LSIO.GPIO1.IO03 */
+#define SC_P_SCU_BOOT_MODE0                      44    /* SCU.DSC.BOOT_MODE0 */
+#define SC_P_SCU_BOOT_MODE1                      45    /* SCU.DSC.BOOT_MODE1 */
+#define SC_P_SCU_BOOT_MODE2                      46    /* SCU.DSC.BOOT_MODE2 */
+#define SC_P_SCU_BOOT_MODE3                      47    /* SCU.DSC.BOOT_MODE3 */
+#define SC_P_SCU_BOOT_MODE4                      48    /* SCU.DSC.BOOT_MODE4, SCU.PMIC_I2C.SCL */
+#define SC_P_SCU_BOOT_MODE5                      49    /* SCU.DSC.BOOT_MODE5, SCU.PMIC_I2C.SDA */
+#define SC_P_LVDS0_GPIO00                        50    /* LVDS0.GPIO0.IO00, LVDS0.PWM0.OUT, LSIO.GPIO1.IO04 */
+#define SC_P_LVDS0_GPIO01                        51    /* LVDS0.GPIO0.IO01, LSIO.GPIO1.IO05 */
+#define SC_P_LVDS0_I2C0_SCL                      52    /* LVDS0.I2C0.SCL, LVDS0.GPIO0.IO02, LSIO.GPIO1.IO06 */
+#define SC_P_LVDS0_I2C0_SDA                      53    /* LVDS0.I2C0.SDA, LVDS0.GPIO0.IO03, LSIO.GPIO1.IO07 */
+#define SC_P_LVDS0_I2C1_SCL                      54    /* LVDS0.I2C1.SCL, DMA.UART2.TX, LSIO.GPIO1.IO08 */
+#define SC_P_LVDS0_I2C1_SDA                      55    /* LVDS0.I2C1.SDA, DMA.UART2.RX, LSIO.GPIO1.IO09 */
+#define SC_P_LVDS1_GPIO00                        56    /* LVDS1.GPIO0.IO00, LVDS1.PWM0.OUT, LSIO.GPIO1.IO10 */
+#define SC_P_LVDS1_GPIO01                        57    /* LVDS1.GPIO0.IO01, LSIO.GPIO1.IO11 */
+#define SC_P_LVDS1_I2C0_SCL                      58    /* LVDS1.I2C0.SCL, LVDS1.GPIO0.IO02, LSIO.GPIO1.IO12 */
+#define SC_P_LVDS1_I2C0_SDA                      59    /* LVDS1.I2C0.SDA, LVDS1.GPIO0.IO03, LSIO.GPIO1.IO13 */
+#define SC_P_LVDS1_I2C1_SCL                      60    /* LVDS1.I2C1.SCL, DMA.UART3.TX, LSIO.GPIO1.IO14 */
+#define SC_P_LVDS1_I2C1_SDA                      61    /* LVDS1.I2C1.SDA, DMA.UART3.RX, LSIO.GPIO1.IO15 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_LVDSGPIO      62    /*  */
+#define SC_P_MIPI_DSI0_I2C0_SCL                  63    /* MIPI_DSI0.I2C0.SCL, LSIO.GPIO1.IO16 */
+#define SC_P_MIPI_DSI0_I2C0_SDA                  64    /* MIPI_DSI0.I2C0.SDA, LSIO.GPIO1.IO17 */
+#define SC_P_MIPI_DSI0_GPIO0_00                  65    /* MIPI_DSI0.GPIO0.IO00, MIPI_DSI0.PWM0.OUT, LSIO.GPIO1.IO18 */
+#define SC_P_MIPI_DSI0_GPIO0_01                  66    /* MIPI_DSI0.GPIO0.IO01, LSIO.GPIO1.IO19 */
+#define SC_P_MIPI_DSI1_I2C0_SCL                  67    /* MIPI_DSI1.I2C0.SCL, LSIO.GPIO1.IO20 */
+#define SC_P_MIPI_DSI1_I2C0_SDA                  68    /* MIPI_DSI1.I2C0.SDA, LSIO.GPIO1.IO21 */
+#define SC_P_MIPI_DSI1_GPIO0_00                  69    /* MIPI_DSI1.GPIO0.IO00, MIPI_DSI1.PWM0.OUT, LSIO.GPIO1.IO22 */
+#define SC_P_MIPI_DSI1_GPIO0_01                  70    /* MIPI_DSI1.GPIO0.IO01, LSIO.GPIO1.IO23 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_MIPIDSIGPIO   71    /*  */
+#define SC_P_MIPI_CSI0_MCLK_OUT                  72    /* MIPI_CSI0.ACM.MCLK_OUT, LSIO.GPIO1.IO24 */
+#define SC_P_MIPI_CSI0_I2C0_SCL                  73    /* MIPI_CSI0.I2C0.SCL, LSIO.GPIO1.IO25 */
+#define SC_P_MIPI_CSI0_I2C0_SDA                  74    /* MIPI_CSI0.I2C0.SDA, LSIO.GPIO1.IO26 */
+#define SC_P_MIPI_CSI0_GPIO0_00                  75    /* MIPI_CSI0.GPIO0.IO00, DMA.I2C0.SCL, MIPI_CSI1.I2C0.SCL, LSIO.GPIO1.IO27 */
+#define SC_P_MIPI_CSI0_GPIO0_01                  76    /* MIPI_CSI0.GPIO0.IO01, DMA.I2C0.SDA, MIPI_CSI1.I2C0.SDA, LSIO.GPIO1.IO28 */
+#define SC_P_MIPI_CSI1_MCLK_OUT                  77    /* MIPI_CSI1.ACM.MCLK_OUT, LSIO.GPIO1.IO29 */
+#define SC_P_MIPI_CSI1_GPIO0_00                  78    /* MIPI_CSI1.GPIO0.IO00, DMA.UART4.RX, LSIO.GPIO1.IO30 */
+#define SC_P_MIPI_CSI1_GPIO0_01                  79    /* MIPI_CSI1.GPIO0.IO01, DMA.UART4.TX, LSIO.GPIO1.IO31 */
+#define SC_P_MIPI_CSI1_I2C0_SCL                  80    /* MIPI_CSI1.I2C0.SCL, LSIO.GPIO2.IO00 */
+#define SC_P_MIPI_CSI1_I2C0_SDA                  81    /* MIPI_CSI1.I2C0.SDA, LSIO.GPIO2.IO01 */
+#define SC_P_HDMI_TX0_TS_SCL                     82    /* HDMI_TX0.I2C0.SCL, DMA.I2C0.SCL, LSIO.GPIO2.IO02 */
+#define SC_P_HDMI_TX0_TS_SDA                     83    /* HDMI_TX0.I2C0.SDA, DMA.I2C0.SDA, LSIO.GPIO2.IO03 */
+#define SC_P_COMP_CTL_GPIO_3V3_HDMIGPIO          84    /*  */
+#define SC_P_ESAI1_FSR                           85    /* AUD.ESAI1.FSR, LSIO.GPIO2.IO04 */
+#define SC_P_ESAI1_FST                           86    /* AUD.ESAI1.FST, AUD.SPDIF0.EXT_CLK, LSIO.GPIO2.IO05 */
+#define SC_P_ESAI1_SCKR                          87    /* AUD.ESAI1.SCKR, LSIO.GPIO2.IO06 */
+#define SC_P_ESAI1_SCKT                          88    /* AUD.ESAI1.SCKT, AUD.SAI2.RXC, AUD.SPDIF0.EXT_CLK, LSIO.GPIO2.IO07 */
+#define SC_P_ESAI1_TX0                           89    /* AUD.ESAI1.TX0, AUD.SAI2.RXD, AUD.SPDIF0.RX, LSIO.GPIO2.IO08 */
+#define SC_P_ESAI1_TX1                           90    /* AUD.ESAI1.TX1, AUD.SAI2.RXFS, AUD.SPDIF0.TX, LSIO.GPIO2.IO09 */
+#define SC_P_ESAI1_TX2_RX3                       91    /* AUD.ESAI1.TX2_RX3, AUD.SPDIF0.RX, LSIO.GPIO2.IO10 */
+#define SC_P_ESAI1_TX3_RX2                       92    /* AUD.ESAI1.TX3_RX2, AUD.SPDIF0.TX, LSIO.GPIO2.IO11 */
+#define SC_P_ESAI1_TX4_RX1                       93    /* AUD.ESAI1.TX4_RX1, LSIO.GPIO2.IO12 */
+#define SC_P_ESAI1_TX5_RX0                       94    /* AUD.ESAI1.TX5_RX0, LSIO.GPIO2.IO13 */
+#define SC_P_SPDIF0_RX                           95    /* AUD.SPDIF0.RX, AUD.MQS.R, AUD.ACM.MCLK_IN1, LSIO.GPIO2.IO14 */
+#define SC_P_SPDIF0_TX                           96    /* AUD.SPDIF0.TX, AUD.MQS.L, AUD.ACM.MCLK_OUT1, LSIO.GPIO2.IO15 */
+#define SC_P_SPDIF0_EXT_CLK                      97    /* AUD.SPDIF0.EXT_CLK, DMA.DMA0.REQ_IN0, LSIO.GPIO2.IO16 */
+#define SC_P_SPI3_SCK                            98    /* DMA.SPI3.SCK, LSIO.GPIO2.IO17 */
+#define SC_P_SPI3_SDO                            99    /* DMA.SPI3.SDO, DMA.FTM.CH0, LSIO.GPIO2.IO18 */
+#define SC_P_SPI3_SDI                            100   /* DMA.SPI3.SDI, DMA.FTM.CH1, LSIO.GPIO2.IO19 */
+#define SC_P_SPI3_CS0                            101   /* DMA.SPI3.CS0, DMA.FTM.CH2, LSIO.GPIO2.IO20 */
+#define SC_P_SPI3_CS1                            102   /* DMA.SPI3.CS1, LSIO.GPIO2.IO21 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHB       103   /*  */
+#define SC_P_ESAI0_FSR                           104   /* AUD.ESAI0.FSR, LSIO.GPIO2.IO22 */
+#define SC_P_ESAI0_FST                           105   /* AUD.ESAI0.FST, LSIO.GPIO2.IO23 */
+#define SC_P_ESAI0_SCKR                          106   /* AUD.ESAI0.SCKR, LSIO.GPIO2.IO24 */
+#define SC_P_ESAI0_SCKT                          107   /* AUD.ESAI0.SCKT, LSIO.GPIO2.IO25 */
+#define SC_P_ESAI0_TX0                           108   /* AUD.ESAI0.TX0, LSIO.GPIO2.IO26 */
+#define SC_P_ESAI0_TX1                           109   /* AUD.ESAI0.TX1, LSIO.GPIO2.IO27 */
+#define SC_P_ESAI0_TX2_RX3                       110   /* AUD.ESAI0.TX2_RX3, LSIO.GPIO2.IO28 */
+#define SC_P_ESAI0_TX3_RX2                       111   /* AUD.ESAI0.TX3_RX2, LSIO.GPIO2.IO29 */
+#define SC_P_ESAI0_TX4_RX1                       112   /* AUD.ESAI0.TX4_RX1, LSIO.GPIO2.IO30 */
+#define SC_P_ESAI0_TX5_RX0                       113   /* AUD.ESAI0.TX5_RX0, LSIO.GPIO2.IO31 */
+#define SC_P_MCLK_IN0                            114   /* AUD.ACM.MCLK_IN0, AUD.ESAI0.RX_HF_CLK, AUD.ESAI1.RX_HF_CLK, LSIO.GPIO3.IO00 */
+#define SC_P_MCLK_OUT0                           115   /* AUD.ACM.MCLK_OUT0, AUD.ESAI0.TX_HF_CLK, AUD.ESAI1.TX_HF_CLK, LSIO.GPIO3.IO01 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHC       116   /*  */
+#define SC_P_SPI0_SCK                            117   /* DMA.SPI0.SCK, AUD.SAI0.RXC, LSIO.GPIO3.IO02 */
+#define SC_P_SPI0_SDO                            118   /* DMA.SPI0.SDO, AUD.SAI0.TXD, LSIO.GPIO3.IO03 */
+#define SC_P_SPI0_SDI                            119   /* DMA.SPI0.SDI, AUD.SAI0.RXD, LSIO.GPIO3.IO04 */
+#define SC_P_SPI0_CS0                            120   /* DMA.SPI0.CS0, AUD.SAI0.RXFS, LSIO.GPIO3.IO05 */
+#define SC_P_SPI0_CS1                            121   /* DMA.SPI0.CS1, AUD.SAI0.TXC, LSIO.GPIO3.IO06 */
+#define SC_P_SPI2_SCK                            122   /* DMA.SPI2.SCK, LSIO.GPIO3.IO07 */
+#define SC_P_SPI2_SDO                            123   /* DMA.SPI2.SDO, LSIO.GPIO3.IO08 */
+#define SC_P_SPI2_SDI                            124   /* DMA.SPI2.SDI, LSIO.GPIO3.IO09 */
+#define SC_P_SPI2_CS0                            125   /* DMA.SPI2.CS0, LSIO.GPIO3.IO10 */
+#define SC_P_SPI2_CS1                            126   /* DMA.SPI2.CS1, AUD.SAI0.TXFS, LSIO.GPIO3.IO11 */
+#define SC_P_SAI1_RXC                            127   /* AUD.SAI1.RXC, AUD.SAI0.TXD, LSIO.GPIO3.IO12 */
+#define SC_P_SAI1_RXD                            128   /* AUD.SAI1.RXD, AUD.SAI0.TXFS, LSIO.GPIO3.IO13 */
+#define SC_P_SAI1_RXFS                           129   /* AUD.SAI1.RXFS, AUD.SAI0.RXD, LSIO.GPIO3.IO14 */
+#define SC_P_SAI1_TXC                            130   /* AUD.SAI1.TXC, AUD.SAI0.TXC, LSIO.GPIO3.IO15 */
+#define SC_P_SAI1_TXD                            131   /* AUD.SAI1.TXD, AUD.SAI1.RXC, LSIO.GPIO3.IO16 */
+#define SC_P_SAI1_TXFS                           132   /* AUD.SAI1.TXFS, AUD.SAI1.RXFS, LSIO.GPIO3.IO17 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIORHT       133   /*  */
+#define SC_P_ADC_IN7                             134   /* DMA.ADC1.IN3, DMA.SPI1.CS1, LSIO.KPP0.ROW3, LSIO.GPIO3.IO25 */
+#define SC_P_ADC_IN6                             135   /* DMA.ADC1.IN2, DMA.SPI1.CS0, LSIO.KPP0.ROW2, LSIO.GPIO3.IO24 */
+#define SC_P_ADC_IN5                             136   /* DMA.ADC1.IN1, DMA.SPI1.SDI, LSIO.KPP0.ROW1, LSIO.GPIO3.IO23 */
+#define SC_P_ADC_IN4                             137   /* DMA.ADC1.IN0, DMA.SPI1.SDO, LSIO.KPP0.ROW0, LSIO.GPIO3.IO22 */
+#define SC_P_ADC_IN3                             138   /* DMA.ADC0.IN3, DMA.SPI1.SCK, LSIO.KPP0.COL3, LSIO.GPIO3.IO21 */
+#define SC_P_ADC_IN2                             139   /* DMA.ADC0.IN2, LSIO.KPP0.COL2, LSIO.GPIO3.IO20 */
+#define SC_P_ADC_IN1                             140   /* DMA.ADC0.IN1, LSIO.KPP0.COL1, LSIO.GPIO3.IO19 */
+#define SC_P_ADC_IN0                             141   /* DMA.ADC0.IN0, LSIO.KPP0.COL0, LSIO.GPIO3.IO18 */
+#define SC_P_MLB_SIG                             142   /* CONN.MLB.SIG, AUD.SAI3.RXC, LSIO.GPIO3.IO26 */
+#define SC_P_MLB_CLK                             143   /* CONN.MLB.CLK, AUD.SAI3.RXFS, LSIO.GPIO3.IO27 */
+#define SC_P_MLB_DATA                            144   /* CONN.MLB.DATA, AUD.SAI3.RXD, LSIO.GPIO3.IO28 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIOLHT       145   /*  */
+#define SC_P_FLEXCAN0_RX                         146   /* DMA.FLEXCAN0.RX, LSIO.GPIO3.IO29 */
+#define SC_P_FLEXCAN0_TX                         147   /* DMA.FLEXCAN0.TX, LSIO.GPIO3.IO30 */
+#define SC_P_FLEXCAN1_RX                         148   /* DMA.FLEXCAN1.RX, LSIO.GPIO3.IO31 */
+#define SC_P_FLEXCAN1_TX                         149   /* DMA.FLEXCAN1.TX, LSIO.GPIO4.IO00 */
+#define SC_P_FLEXCAN2_RX                         150   /* DMA.FLEXCAN2.RX, LSIO.GPIO4.IO01 */
+#define SC_P_FLEXCAN2_TX                         151   /* DMA.FLEXCAN2.TX, LSIO.GPIO4.IO02 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIOTHR       152   /*  */
+#define SC_P_USB_SS3_TC0                         153   /* DMA.I2C1.SCL, CONN.USB_OTG1.PWR, LSIO.GPIO4.IO03 */
+#define SC_P_USB_SS3_TC1                         154   /* DMA.I2C1.SCL, CONN.USB_OTG2.PWR, LSIO.GPIO4.IO04 */
+#define SC_P_USB_SS3_TC2                         155   /* DMA.I2C1.SDA, CONN.USB_OTG1.OC, LSIO.GPIO4.IO05 */
+#define SC_P_USB_SS3_TC3                         156   /* DMA.I2C1.SDA, CONN.USB_OTG2.OC, LSIO.GPIO4.IO06 */
+#define SC_P_COMP_CTL_GPIO_3V3_USB3IO            157   /*  */
+#define SC_P_USDHC1_RESET_B                      158   /* CONN.USDHC1.RESET_B, LSIO.GPIO4.IO07 */
+#define SC_P_USDHC1_VSELECT                      159   /* CONN.USDHC1.VSELECT, LSIO.GPIO4.IO08 */
+#define SC_P_USDHC2_RESET_B                      160   /* CONN.USDHC2.RESET_B, LSIO.GPIO4.IO09 */
+#define SC_P_USDHC2_VSELECT                      161   /* CONN.USDHC2.VSELECT, LSIO.GPIO4.IO10 */
+#define SC_P_USDHC2_WP                           162   /* CONN.USDHC2.WP, LSIO.GPIO4.IO11 */
+#define SC_P_USDHC2_CD_B                         163   /* CONN.USDHC2.CD_B, LSIO.GPIO4.IO12 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_VSELSEP       164   /*  */
+#define SC_P_ENET0_MDIO                          165   /* CONN.ENET0.MDIO, DMA.I2C4.SDA, LSIO.GPIO4.IO13 */
+#define SC_P_ENET0_MDC                           166   /* CONN.ENET0.MDC, DMA.I2C4.SCL, LSIO.GPIO4.IO14 */
+#define SC_P_ENET0_REFCLK_125M_25M               167   /* CONN.ENET0.REFCLK_125M_25M, CONN.ENET0.PPS, LSIO.GPIO4.IO15 */
+#define SC_P_ENET1_REFCLK_125M_25M               168   /* CONN.ENET1.REFCLK_125M_25M, CONN.ENET1.PPS, LSIO.GPIO4.IO16 */
+#define SC_P_ENET1_MDIO                          169   /* CONN.ENET1.MDIO, DMA.I2C4.SDA, LSIO.GPIO4.IO17 */
+#define SC_P_ENET1_MDC                           170   /* CONN.ENET1.MDC, DMA.I2C4.SCL, LSIO.GPIO4.IO18 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_GPIOCT        171   /*  */
+#define SC_P_QSPI1A_SS0_B                        172   /* LSIO.QSPI1A.SS0_B, LSIO.GPIO4.IO19 */
+#define SC_P_QSPI1A_SS1_B                        173   /* LSIO.QSPI1A.SS1_B, LSIO.QSPI1A.SCLK2, LSIO.GPIO4.IO20 */
+#define SC_P_QSPI1A_SCLK                         174   /* LSIO.QSPI1A.SCLK, LSIO.GPIO4.IO21 */
+#define SC_P_QSPI1A_DQS                          175   /* LSIO.QSPI1A.DQS, LSIO.GPIO4.IO22 */
+#define SC_P_QSPI1A_DATA3                        176   /* LSIO.QSPI1A.DATA3, DMA.I2C1.SDA, CONN.USB_OTG1.OC, LSIO.GPIO4.IO23 */
+#define SC_P_QSPI1A_DATA2                        177   /* LSIO.QSPI1A.DATA2, DMA.I2C1.SCL, CONN.USB_OTG2.PWR, LSIO.GPIO4.IO24 */
+#define SC_P_QSPI1A_DATA1                        178   /* LSIO.QSPI1A.DATA1, DMA.I2C1.SDA, CONN.USB_OTG2.OC, LSIO.GPIO4.IO25 */
+#define SC_P_QSPI1A_DATA0                        179   /* LSIO.QSPI1A.DATA0, LSIO.GPIO4.IO26 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI1         180   /*  */
+#define SC_P_QSPI0A_DATA0                        181   /* LSIO.QSPI0A.DATA0 */
+#define SC_P_QSPI0A_DATA1                        182   /* LSIO.QSPI0A.DATA1 */
+#define SC_P_QSPI0A_DATA2                        183   /* LSIO.QSPI0A.DATA2 */
+#define SC_P_QSPI0A_DATA3                        184   /* LSIO.QSPI0A.DATA3 */
+#define SC_P_QSPI0A_DQS                          185   /* LSIO.QSPI0A.DQS */
+#define SC_P_QSPI0A_SS0_B                        186   /* LSIO.QSPI0A.SS0_B */
+#define SC_P_QSPI0A_SS1_B                        187   /* LSIO.QSPI0A.SS1_B, LSIO.QSPI0A.SCLK2 */
+#define SC_P_QSPI0A_SCLK                         188   /* LSIO.QSPI0A.SCLK */
+#define SC_P_QSPI0B_SCLK                         189   /* LSIO.QSPI0B.SCLK */
+#define SC_P_QSPI0B_DATA0                        190   /* LSIO.QSPI0B.DATA0 */
+#define SC_P_QSPI0B_DATA1                        191   /* LSIO.QSPI0B.DATA1 */
+#define SC_P_QSPI0B_DATA2                        192   /* LSIO.QSPI0B.DATA2 */
+#define SC_P_QSPI0B_DATA3                        193   /* LSIO.QSPI0B.DATA3 */
+#define SC_P_QSPI0B_DQS                          194   /* LSIO.QSPI0B.DQS */
+#define SC_P_QSPI0B_SS0_B                        195   /* LSIO.QSPI0B.SS0_B */
+#define SC_P_QSPI0B_SS1_B                        196   /* LSIO.QSPI0B.SS1_B, LSIO.QSPI0B.SCLK2 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_QSPI0         197   /*  */
+#define SC_P_PCIE_CTRL0_CLKREQ_B                 198   /* HSIO.PCIE0.CLKREQ_B, LSIO.GPIO4.IO27 */
+#define SC_P_PCIE_CTRL0_WAKE_B                   199   /* HSIO.PCIE0.WAKE_B, LSIO.GPIO4.IO28 */
+#define SC_P_PCIE_CTRL0_PERST_B                  200   /* HSIO.PCIE0.PERST_B, LSIO.GPIO4.IO29 */
+#define SC_P_PCIE_CTRL1_CLKREQ_B                 201   /* HSIO.PCIE1.CLKREQ_B, DMA.I2C1.SDA, CONN.USB_OTG2.OC, LSIO.GPIO4.IO30 */
+#define SC_P_PCIE_CTRL1_WAKE_B                   202   /* HSIO.PCIE1.WAKE_B, DMA.I2C1.SCL, CONN.USB_OTG2.PWR, LSIO.GPIO4.IO31 */
+#define SC_P_PCIE_CTRL1_PERST_B                  203   /* HSIO.PCIE1.PERST_B, DMA.I2C1.SCL, CONN.USB_OTG1.PWR, LSIO.GPIO5.IO00 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_PCIESEP       204   /*  */
+#define SC_P_USB_HSIC0_DATA                      205   /* CONN.USB_HSIC0.DATA, DMA.I2C1.SDA, LSIO.GPIO5.IO01 */
+#define SC_P_USB_HSIC0_STROBE                    206   /* CONN.USB_HSIC0.STROBE, DMA.I2C1.SCL, LSIO.GPIO5.IO02 */
+#define SC_P_CALIBRATION_0_HSIC                  207   /*  */
+#define SC_P_CALIBRATION_1_HSIC                  208   /*  */
+#define SC_P_EMMC0_CLK                           209   /* CONN.EMMC0.CLK, CONN.NAND.READY_B */
+#define SC_P_EMMC0_CMD                           210   /* CONN.EMMC0.CMD, CONN.NAND.DQS, AUD.MQS.R, LSIO.GPIO5.IO03 */
+#define SC_P_EMMC0_DATA0                         211   /* CONN.EMMC0.DATA0, CONN.NAND.DATA00, LSIO.GPIO5.IO04 */
+#define SC_P_EMMC0_DATA1                         212   /* CONN.EMMC0.DATA1, CONN.NAND.DATA01, LSIO.GPIO5.IO05 */
+#define SC_P_EMMC0_DATA2                         213   /* CONN.EMMC0.DATA2, CONN.NAND.DATA02, LSIO.GPIO5.IO06 */
+#define SC_P_EMMC0_DATA3                         214   /* CONN.EMMC0.DATA3, CONN.NAND.DATA03, LSIO.GPIO5.IO07 */
+#define SC_P_EMMC0_DATA4                         215   /* CONN.EMMC0.DATA4, CONN.NAND.DATA04, LSIO.GPIO5.IO08 */
+#define SC_P_EMMC0_DATA5                         216   /* CONN.EMMC0.DATA5, CONN.NAND.DATA05, LSIO.GPIO5.IO09 */
+#define SC_P_EMMC0_DATA6                         217   /* CONN.EMMC0.DATA6, CONN.NAND.DATA06, LSIO.GPIO5.IO10 */
+#define SC_P_EMMC0_DATA7                         218   /* CONN.EMMC0.DATA7, CONN.NAND.DATA07, LSIO.GPIO5.IO11 */
+#define SC_P_EMMC0_STROBE                        219   /* CONN.EMMC0.STROBE, CONN.NAND.CLE, LSIO.GPIO5.IO12 */
+#define SC_P_EMMC0_RESET_B                       220   /* CONN.EMMC0.RESET_B, CONN.NAND.WP_B, CONN.USDHC1.VSELECT, LSIO.GPIO5.IO13 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_SD1FIX        221   /*  */
+#define SC_P_USDHC1_CLK                          222   /* CONN.USDHC1.CLK, AUD.MQS.R */
+#define SC_P_USDHC1_CMD                          223   /* CONN.USDHC1.CMD, AUD.MQS.L, LSIO.GPIO5.IO14 */
+#define SC_P_USDHC1_DATA0                        224   /* CONN.USDHC1.DATA0, CONN.NAND.RE_N, LSIO.GPIO5.IO15 */
+#define SC_P_USDHC1_DATA1                        225   /* CONN.USDHC1.DATA1, CONN.NAND.RE_P, LSIO.GPIO5.IO16 */
+#define SC_P_CTL_NAND_RE_P_N                     226   /*  */
+#define SC_P_USDHC1_DATA2                        227   /* CONN.USDHC1.DATA2, CONN.NAND.DQS_N, LSIO.GPIO5.IO17 */
+#define SC_P_USDHC1_DATA3                        228   /* CONN.USDHC1.DATA3, CONN.NAND.DQS_P, LSIO.GPIO5.IO18 */
+#define SC_P_CTL_NAND_DQS_P_N                    229   /*  */
+#define SC_P_USDHC1_DATA4                        230   /* CONN.USDHC1.DATA4, CONN.NAND.CE0_B, AUD.MQS.R, LSIO.GPIO5.IO19 */
+#define SC_P_USDHC1_DATA5                        231   /* CONN.USDHC1.DATA5, CONN.NAND.RE_B, AUD.MQS.L, LSIO.GPIO5.IO20 */
+#define SC_P_USDHC1_DATA6                        232   /* CONN.USDHC1.DATA6, CONN.NAND.WE_B, CONN.USDHC1.WP, LSIO.GPIO5.IO21 */
+#define SC_P_USDHC1_DATA7                        233   /* CONN.USDHC1.DATA7, CONN.NAND.ALE, CONN.USDHC1.CD_B, LSIO.GPIO5.IO22 */
+#define SC_P_USDHC1_STROBE                       234   /* CONN.USDHC1.STROBE, CONN.NAND.CE1_B, CONN.USDHC1.RESET_B, LSIO.GPIO5.IO23 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_VSEL2         235   /*  */
+#define SC_P_USDHC2_CLK                          236   /* CONN.USDHC2.CLK, AUD.MQS.R, LSIO.GPIO5.IO24 */
+#define SC_P_USDHC2_CMD                          237   /* CONN.USDHC2.CMD, AUD.MQS.L, LSIO.GPIO5.IO25 */
+#define SC_P_USDHC2_DATA0                        238   /* CONN.USDHC2.DATA0, DMA.UART4.RX, LSIO.GPIO5.IO26 */
+#define SC_P_USDHC2_DATA1                        239   /* CONN.USDHC2.DATA1, DMA.UART4.TX, LSIO.GPIO5.IO27 */
+#define SC_P_USDHC2_DATA2                        240   /* CONN.USDHC2.DATA2, DMA.UART4.CTS_B, LSIO.GPIO5.IO28 */
+#define SC_P_USDHC2_DATA3                        241   /* CONN.USDHC2.DATA3, DMA.UART4.RTS_B, LSIO.GPIO5.IO29 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_VSEL3         242   /*  */
+#define SC_P_ENET0_RGMII_TXC                     243   /* CONN.ENET0.RGMII_TXC, CONN.ENET0.RCLK50M_OUT, CONN.ENET0.RCLK50M_IN, LSIO.GPIO5.IO30 */
+#define SC_P_ENET0_RGMII_TX_CTL                  244   /* CONN.ENET0.RGMII_TX_CTL, LSIO.GPIO5.IO31 */
+#define SC_P_ENET0_RGMII_TXD0                    245   /* CONN.ENET0.RGMII_TXD0, LSIO.GPIO6.IO00 */
+#define SC_P_ENET0_RGMII_TXD1                    246   /* CONN.ENET0.RGMII_TXD1, LSIO.GPIO6.IO01 */
+#define SC_P_ENET0_RGMII_TXD2                    247   /* CONN.ENET0.RGMII_TXD2, DMA.UART3.TX, VPU.TSI_S1.VID, LSIO.GPIO6.IO02 */
+#define SC_P_ENET0_RGMII_TXD3                    248   /* CONN.ENET0.RGMII_TXD3, DMA.UART3.RTS_B, VPU.TSI_S1.SYNC, LSIO.GPIO6.IO03 */
+#define SC_P_ENET0_RGMII_RXC                     249   /* CONN.ENET0.RGMII_RXC, DMA.UART3.CTS_B, VPU.TSI_S1.DATA, LSIO.GPIO6.IO04 */
+#define SC_P_ENET0_RGMII_RX_CTL                  250   /* CONN.ENET0.RGMII_RX_CTL, VPU.TSI_S0.VID, LSIO.GPIO6.IO05 */
+#define SC_P_ENET0_RGMII_RXD0                    251   /* CONN.ENET0.RGMII_RXD0, VPU.TSI_S0.SYNC, LSIO.GPIO6.IO06 */
+#define SC_P_ENET0_RGMII_RXD1                    252   /* CONN.ENET0.RGMII_RXD1, VPU.TSI_S0.DATA, LSIO.GPIO6.IO07 */
+#define SC_P_ENET0_RGMII_RXD2                    253   /* CONN.ENET0.RGMII_RXD2, CONN.ENET0.RMII_RX_ER, VPU.TSI_S0.CLK, LSIO.GPIO6.IO08 */
+#define SC_P_ENET0_RGMII_RXD3                    254   /* CONN.ENET0.RGMII_RXD3, DMA.UART3.RX, VPU.TSI_S1.CLK, LSIO.GPIO6.IO09 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_ENET_ENETB    255   /*  */
+#define SC_P_ENET1_RGMII_TXC                     256   /* CONN.ENET1.RGMII_TXC, CONN.ENET1.RCLK50M_OUT, CONN.ENET1.RCLK50M_IN, LSIO.GPIO6.IO10 */
+#define SC_P_ENET1_RGMII_TX_CTL                  257   /* CONN.ENET1.RGMII_TX_CTL, LSIO.GPIO6.IO11 */
+#define SC_P_ENET1_RGMII_TXD0                    258   /* CONN.ENET1.RGMII_TXD0, LSIO.GPIO6.IO12 */
+#define SC_P_ENET1_RGMII_TXD1                    259   /* CONN.ENET1.RGMII_TXD1, LSIO.GPIO6.IO13 */
+#define SC_P_ENET1_RGMII_TXD2                    260   /* CONN.ENET1.RGMII_TXD2, DMA.UART3.TX, VPU.TSI_S1.VID, LSIO.GPIO6.IO14 */
+#define SC_P_ENET1_RGMII_TXD3                    261   /* CONN.ENET1.RGMII_TXD3, DMA.UART3.RTS_B, VPU.TSI_S1.SYNC, LSIO.GPIO6.IO15 */
+#define SC_P_ENET1_RGMII_RXC                     262   /* CONN.ENET1.RGMII_RXC, DMA.UART3.CTS_B, VPU.TSI_S1.DATA, LSIO.GPIO6.IO16 */
+#define SC_P_ENET1_RGMII_RX_CTL                  263   /* CONN.ENET1.RGMII_RX_CTL, VPU.TSI_S0.VID, LSIO.GPIO6.IO17 */
+#define SC_P_ENET1_RGMII_RXD0                    264   /* CONN.ENET1.RGMII_RXD0, VPU.TSI_S0.SYNC, LSIO.GPIO6.IO18 */
+#define SC_P_ENET1_RGMII_RXD1                    265   /* CONN.ENET1.RGMII_RXD1, VPU.TSI_S0.DATA, LSIO.GPIO6.IO19 */
+#define SC_P_ENET1_RGMII_RXD2                    266   /* CONN.ENET1.RGMII_RXD2, CONN.ENET1.RMII_RX_ER, VPU.TSI_S0.CLK, LSIO.GPIO6.IO20 */
+#define SC_P_ENET1_RGMII_RXD3                    267   /* CONN.ENET1.RGMII_RXD3, DMA.UART3.RX, VPU.TSI_S1.CLK, LSIO.GPIO6.IO21 */
+#define SC_P_COMP_CTL_GPIO_1V8_3V3_ENET_ENETA    268   /*  */
+/*@}*/
+
+#endif                         /* SC_PADS_H */
diff --git a/plat/imx/imx8qm/imx8qm_bl31_setup.c b/plat/imx/imx8qm/imx8qm_bl31_setup.c
new file mode 100644 (file)
index 0000000..6cfdaf8
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch_helpers.h>
+#include <assert.h>
+#include <bl_common.h>
+#include <cci.h>
+#include <console.h>
+#include <context.h>
+#include <context_mgmt.h>
+#include <debug.h>
+#include <imx8qm_pads.h>
+#include <imx8_iomux.h>
+#include <imx8_lpuart.h>
+#include <mmio.h>
+#include <platform.h>
+#include <platform_def.h>
+#include <plat_imx8.h>
+#include <sci/sci.h>
+#include <sec_rsrc.h>
+#include <stdbool.h>
+#include <xlat_tables.h>
+
+IMPORT_SYM(unsigned long, __COHERENT_RAM_START__, BL31_COHERENT_RAM_START);
+IMPORT_SYM(unsigned long, __COHERENT_RAM_END__, BL31_COHERENT_RAM_END);
+IMPORT_SYM(unsigned long, __RO_START__, BL31_RO_START);
+IMPORT_SYM(unsigned long, __RO_END__, BL31_RO_END);
+IMPORT_SYM(unsigned long, __RW_START__, BL31_RW_START);
+IMPORT_SYM(unsigned long, __RW_END__, BL31_RW_END);
+
+static entry_point_info_t bl32_image_ep_info;
+static entry_point_info_t bl33_image_ep_info;
+
+#define UART_PAD_CTRL  (PADRING_IFMUX_EN_MASK | PADRING_GP_EN_MASK | \
+                       (SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | \
+                       (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \
+                       (SC_PAD_28FDSOI_DSE_DV_LOW << PADRING_DSE_SHIFT) | \
+                       (SC_PAD_28FDSOI_PS_PD << PADRING_PULL_SHIFT))
+
+const static int imx8qm_cci_map[] = {
+       CLUSTER0_CCI_SLVAE_IFACE,
+       CLUSTER1_CCI_SLVAE_IFACE
+};
+
+static const mmap_region_t imx_mmap[] = {
+       MAP_REGION_FLAT(IMX_BOOT_UART_BASE, IMX_BOOT_UART_SIZE, MT_DEVICE | MT_RW),
+       MAP_REGION_FLAT(SC_IPC_BASE, SC_IPC_SIZE, MT_DEVICE | MT_RW),
+       MAP_REGION_FLAT(PLAT_GICD_BASE, PLAT_GICD_SIZE, MT_DEVICE | MT_RW),
+       MAP_REGION_FLAT(PLAT_GICR_BASE, PLAT_GICR_SIZE, MT_DEVICE | MT_RW),
+       MAP_REGION_FLAT(PLAT_CCI_BASE, PLAT_CCI_SIZE, MT_DEVICE | MT_RW),
+       {0}
+};
+
+static uint32_t get_spsr_for_bl33_entry(void)
+{
+       unsigned long el_status;
+       unsigned long mode;
+       uint32_t spsr;
+
+       /* figure out what mode we enter the non-secure world */
+       el_status = read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL2_SHIFT;
+       el_status &= ID_AA64PFR0_ELX_MASK;
+
+       mode = (el_status) ? MODE_EL2 : MODE_EL1;
+       spsr = SPSR_64(mode, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS);
+
+       return spsr;
+}
+
+#if DEBUG_CONSOLE_A53
+static void lpuart32_serial_setbrg(unsigned int base, int baudrate)
+{
+       unsigned int sbr, osr, baud_diff, tmp_osr, tmp_sbr;
+       unsigned int diff1, diff2, tmp, rate;
+
+       if (baudrate == 0)
+               panic();
+
+       sc_pm_get_clock_rate(ipc_handle, SC_R_UART_0, 2, &rate);
+
+       baud_diff = baudrate;
+       osr = 0;
+       sbr = 0;
+       for (tmp_osr = 4; tmp_osr <= 32; tmp_osr++) {
+               tmp_sbr = (rate / (baudrate * tmp_osr));
+               if (tmp_sbr == 0)
+                       tmp_sbr = 1;
+
+               /* calculate difference in actual baud w/ current values */
+               diff1 = rate / (tmp_osr * tmp_sbr) - baudrate;
+               diff2 = rate / (tmp_osr * (tmp_sbr + 1));
+
+               /* select best values between sbr and sbr+1 */
+               if (diff1 > (baudrate - diff2)) {
+                       diff1 = baudrate - diff2;
+                       tmp_sbr++;
+               }
+
+               if (diff1 <= baud_diff) {
+                       baud_diff = diff1;
+                       osr = tmp_osr;
+                       sbr = tmp_sbr;
+               }
+       }
+
+       tmp = mmio_read_32(IMX_BOOT_UART_BASE + BAUD);
+
+       if ((osr > 3) && (osr < 8))
+               tmp |= LPUART_BAUD_BOTHEDGE_MASK;
+
+       tmp &= ~LPUART_BAUD_OSR_MASK;
+       tmp |= LPUART_BAUD_OSR(osr - 1);
+       tmp &= ~LPUART_BAUD_SBR_MASK;
+       tmp |= LPUART_BAUD_SBR(sbr);
+
+       /* explicitly disable 10 bit mode & set 1 stop bit */
+       tmp &= ~(LPUART_BAUD_M10_MASK | LPUART_BAUD_SBNS_MASK);
+
+       mmio_write_32(IMX_BOOT_UART_BASE + BAUD, tmp);
+}
+
+static int lpuart32_serial_init(unsigned int base)
+{
+       unsigned int tmp;
+
+       /* disable TX & RX before enabling clocks */
+       tmp = mmio_read_32(IMX_BOOT_UART_BASE + CTRL);
+       tmp &= ~(CTRL_TE | CTRL_RE);
+       mmio_write_32(IMX_BOOT_UART_BASE + CTRL, tmp);
+
+       mmio_write_32(IMX_BOOT_UART_BASE + MODIR, 0);
+       mmio_write_32(IMX_BOOT_UART_BASE + FIFO, ~(FIFO_TXFE | FIFO_RXFE));
+
+       mmio_write_32(IMX_BOOT_UART_BASE + MATCH, 0);
+
+       /* provide data bits, parity, stop bit, etc */
+       lpuart32_serial_setbrg(base, IMX_BOOT_UART_BAUDRATE);
+
+       /* eight data bits no parity bit */
+       tmp = mmio_read_32(IMX_BOOT_UART_BASE + CTRL);
+       tmp &= ~(LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK | LPUART_CTRL_M_MASK);
+       mmio_write_32(IMX_BOOT_UART_BASE + CTRL, tmp);
+
+       mmio_write_32(IMX_BOOT_UART_BASE + CTRL, CTRL_RE | CTRL_TE);
+
+       mmio_write_32(IMX_BOOT_UART_BASE + DATA, 0x55);
+       mmio_write_32(IMX_BOOT_UART_BASE + DATA, 0x55);
+       mmio_write_32(IMX_BOOT_UART_BASE + DATA, 0x0A);
+
+       return 0;
+}
+#endif
+
+void mx8_partition_resources(void)
+{
+       sc_rm_pt_t secure_part, os_part;
+       sc_rm_mr_t mr, mr_record = 64;
+       sc_faddr_t start, end;
+       bool owned, owned2;
+       sc_err_t err;
+       int i;
+
+       err = sc_rm_get_partition(ipc_handle, &secure_part);
+
+       err = sc_rm_partition_alloc(ipc_handle, &os_part, false, false,
+               false, false, false);
+
+       err = sc_rm_set_parent(ipc_handle, os_part, secure_part);
+
+       /* set secure resources to NOT-movable */
+       for (i = 0; i < ARRAY_SIZE(secure_rsrcs); i++) {
+               err = sc_rm_set_resource_movable(ipc_handle, secure_rsrcs[i],
+                       secure_rsrcs[i], false);
+               if (err)
+                       ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+                               secure_rsrcs[i], err);
+       }
+
+       owned = sc_rm_is_resource_owned(ipc_handle, SC_R_M4_0_PID0);
+       if (owned) {
+               err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
+                               SC_R_M4_0_PID0, false);
+               if (err)
+                       ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+                               SC_R_M4_0_PID0, err);
+       }
+
+       owned2 = sc_rm_is_resource_owned(ipc_handle, SC_R_M4_1_PID0);
+       if (owned2) {
+               err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_1_PID0,
+                               SC_R_M4_1_PID0, false);
+               if (err)
+                       ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+                               SC_R_M4_1_PID0, err);
+       }
+       /* move all movable resources and pins to non-secure partition */
+       err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true);
+       if (err)
+               ERROR("sc_rm_move_all: %u\n", err);
+
+       /* iterate through peripherals to give NS OS part access */
+       for (i = 0; i < ARRAY_SIZE(ns_access_allowed); i++) {
+               err = sc_rm_set_peripheral_permissions(ipc_handle, ns_access_allowed[i],
+                       os_part, SC_RM_PERM_FULL);
+               if (err)
+                       ERROR("sc_rm_set_peripheral_permissions: rsrc %u, \
+                               ret %u\n", ns_access_allowed[i], err);
+       }
+
+       if (owned) {
+               err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
+                               SC_R_M4_0_PID0, true);
+               if (err)
+                       ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+                               SC_R_M4_0_PID0, err);
+               err = sc_rm_assign_resource(ipc_handle, os_part, SC_R_M4_0_PID0);
+               if (err)
+                       ERROR("sc_rm_assign_resource: rsrc %u, ret %u\n",
+                               SC_R_M4_0_PID0, err);
+       }
+       if (owned2) {
+               err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_1_PID0,
+                               SC_R_M4_1_PID0, true);
+               if (err)
+                       ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+                               SC_R_M4_1_PID0, err);
+               err = sc_rm_assign_resource(ipc_handle, os_part, SC_R_M4_1_PID0);
+               if (err)
+                       ERROR("sc_rm_assign_resource: rsrc %u, ret %u\n",
+                               SC_R_M4_1_PID0, err);
+       }
+
+       /*
+        * sc_rm_set_peripheral_permissions
+        * sc_rm_set_memreg_permissions
+        * sc_rm_set_pin_movable
+        */
+
+       for (mr = 0; mr < 64; mr++) {
+               owned = sc_rm_is_memreg_owned(ipc_handle, mr);
+               if (owned) {
+                       err = sc_rm_get_memreg_info(ipc_handle, mr, &start, &end);
+                       if (err)
+                               ERROR("Memreg get info failed, %u\n", mr);
+                       NOTICE("Memreg %u 0x%llx -- 0x%llx\n", mr, start, end);
+                       if (BL31_BASE >= start && (BL31_LIMIT - 1) <= end) {
+                               mr_record = mr; /* Record the mr for ATF running */
+                       } else {
+                               err = sc_rm_assign_memreg(ipc_handle, os_part, mr);
+                               if (err)
+                                       ERROR("Memreg assign failed, 0x%llx -- 0x%llx, \
+                                               err %d\n", start, end, err);
+                       }
+               }
+       }
+
+       if (mr_record != 64) {
+               err = sc_rm_get_memreg_info(ipc_handle, mr_record, &start, &end);
+               if (err)
+                       ERROR("Memreg get info failed, %u\n", mr_record);
+               if ((BL31_LIMIT - 1) < end) {
+                       err = sc_rm_memreg_alloc(ipc_handle, &mr, BL31_LIMIT, end);
+                       if (err)
+                               ERROR("sc_rm_memreg_alloc failed, 0x%llx -- 0x%llx\n",
+                                       (sc_faddr_t)BL31_LIMIT, end);
+                       err = sc_rm_assign_memreg(ipc_handle, os_part, mr);
+                       if (err)
+                               ERROR("Memreg assign failed, 0x%llx -- 0x%llx\n",
+                                       (sc_faddr_t)BL31_LIMIT, end);
+               }
+
+               if (start < (BL31_BASE - 1)) {
+                       err = sc_rm_memreg_alloc(ipc_handle, &mr, start, BL31_BASE - 1);
+                       if (err)
+                               ERROR("sc_rm_memreg_alloc failed, 0x%llx -- 0x%llx\n",
+                                       start, (sc_faddr_t)BL31_BASE - 1);
+                       err = sc_rm_assign_memreg(ipc_handle, os_part, mr);
+                               if (err)
+                                       ERROR("Memreg assign failed, 0x%llx -- 0x%llx\n",
+                                               start, (sc_faddr_t)BL31_BASE - 1);
+               }
+       }
+
+       if (err)
+               NOTICE("Partitioning Failed\n");
+       else
+               NOTICE("Non-secure Partitioning Succeeded\n");
+
+}
+
+void bl31_early_platform_setup(bl31_params_t *from_bl2,
+                               void *plat_params_from_bl2)
+{
+#if DEBUG_CONSOLE
+       static console_lpuart_t console;
+#endif
+       if (sc_ipc_open(&ipc_handle, SC_IPC_BASE) != SC_ERR_NONE)
+               panic();
+
+#if DEBUG_CONSOLE_A53
+       sc_pm_set_resource_power_mode(ipc_handle, SC_R_UART_0, SC_PM_PW_MODE_ON);
+       sc_pm_clock_rate_t rate = 80000000;
+       sc_pm_set_clock_rate(ipc_handle, SC_R_UART_0, 2, &rate);
+       sc_pm_clock_enable(ipc_handle, SC_R_UART_0, 2, true, false);
+
+       /* configure UART pads */
+       sc_pad_set(ipc_handle, SC_P_UART0_RX, UART_PAD_CTRL);
+       sc_pad_set(ipc_handle, SC_P_UART0_TX, UART_PAD_CTRL);
+       sc_pad_set(ipc_handle, SC_P_UART0_RTS_B, UART_PAD_CTRL);
+       sc_pad_set(ipc_handle, SC_P_UART0_CTS_B, UART_PAD_CTRL);
+       lpuart32_serial_init(IMX_BOOT_UART_BASE);
+#endif
+
+#if DEBUG_CONSOLE
+       console_lpuart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
+                    IMX_CONSOLE_BAUDRATE, &console);
+#endif
+
+       /* turn on MU1 for non-secure OS/Hypervisor */
+       sc_pm_set_resource_power_mode(ipc_handle, SC_R_MU_1A, SC_PM_PW_MODE_ON);
+
+       /*
+        * create new partition for non-secure OS/Hypervisor
+        * uses global structs defined in sec_rsrc.h
+        */
+       mx8_partition_resources();
+
+       bl33_image_ep_info.pc = PLAT_NS_IMAGE_OFFSET;
+       bl33_image_ep_info.spsr = get_spsr_for_bl33_entry();
+       SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
+
+       /* init the first cluster's cci slave interface */
+       cci_init(PLAT_CCI_BASE, imx8qm_cci_map, PLATFORM_CLUSTER_COUNT);
+       cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr_el1()));
+}
+
+void bl31_plat_arch_setup(void)
+{
+       unsigned long ro_start = BL31_RO_START;
+       unsigned long ro_size = BL31_RO_END - BL31_RO_START;
+       unsigned long rw_start = BL31_RW_START;
+       unsigned long rw_size = BL31_RW_END - BL31_RW_START;
+#if USE_COHERENT_MEM
+       unsigned long coh_start = BL31_COHERENT_RAM_START;
+       unsigned long coh_size = BL31_COHERENT_RAM_END - BL31_COHERENT_RAM_START;
+#endif
+
+       mmap_add_region(ro_start, ro_start, ro_size,
+               MT_RO | MT_MEMORY | MT_SECURE);
+       mmap_add_region(rw_start, rw_start, rw_size,
+               MT_RW | MT_MEMORY | MT_SECURE);
+       mmap_add(imx_mmap);
+
+#if USE_COHERENT_MEM
+       mmap_add_region(coh_start, coh_start, coh_size,
+                       MT_DEVICE | MT_RW | MT_SECURE);
+#endif
+
+       /* setup xlat table */
+       init_xlat_tables();
+       /* enable the MMU */
+       enable_mmu_el3(0);
+}
+
+void bl31_platform_setup(void)
+{
+       plat_gic_driver_init();
+       plat_gic_init();
+}
+
+entry_point_info_t *bl31_plat_get_next_image_ep_info(unsigned int type)
+{
+       if (type == NON_SECURE)
+               return &bl33_image_ep_info;
+       if (type == SECURE)
+               return &bl32_image_ep_info;
+
+       return NULL;
+}
+
+unsigned int plat_get_syscnt_freq2(void)
+{
+       return COUNTER_FREQUENCY;
+}
+
+void bl31_plat_runtime_setup(void)
+{
+       return;
+}
diff --git a/plat/imx/imx8qm/imx8qm_psci.c b/plat/imx/imx8qm/imx8qm_psci.c
new file mode 100644 (file)
index 0000000..b9b794b
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <arch_helpers.h>
+#include <cci.h>
+#include <debug.h>
+#include <gicv3.h>
+#include <mmio.h>
+#include <plat_imx8.h>
+#include <psci.h>
+#include <sci/sci.h>
+#include <stdbool.h>
+
+const static int ap_core_index[PLATFORM_CORE_COUNT] = {
+       SC_R_A53_0, SC_R_A53_1, SC_R_A53_2,
+       SC_R_A53_3, SC_R_A72_0, SC_R_A72_1,
+};
+
+/* need to enable USE_COHERENT_MEM to avoid coherence issue */
+#if USE_COHERENT_MEM
+static unsigned int a53_cpu_on_number __section("tzfw_coherent_mem");
+static unsigned int a72_cpu_on_number __section("tzfw_coherent_mem");
+#endif
+
+int imx_pwr_domain_on(u_register_t mpidr)
+{
+       int ret = PSCI_E_SUCCESS;
+       unsigned int cluster_id, cpu_id;
+
+       cluster_id = MPIDR_AFFLVL1_VAL(mpidr);
+       cpu_id = MPIDR_AFFLVL0_VAL(mpidr);
+
+       tf_printf("imx_pwr_domain_on cluster_id %d, cpu_id %d\n", cluster_id, cpu_id);
+
+       if (cluster_id == 0) {
+               if (a53_cpu_on_number == 0)
+                       sc_pm_set_resource_power_mode(ipc_handle, SC_R_A53, SC_PM_PW_MODE_ON);
+
+               if (sc_pm_set_resource_power_mode(ipc_handle, ap_core_index[cpu_id],
+                       SC_PM_PW_MODE_ON) != SC_ERR_NONE) {
+                       ERROR("cluster0 core %d power on failed!\n", cpu_id);
+                       ret = PSCI_E_INTERN_FAIL;
+               }
+
+               if (sc_pm_cpu_start(ipc_handle, ap_core_index[cpu_id],
+                       true, BL31_BASE) != SC_ERR_NONE) {
+                       ERROR("boot cluster0 core %d failed!\n", cpu_id);
+                       ret = PSCI_E_INTERN_FAIL;
+               }
+       } else {
+               if (a72_cpu_on_number == 0)
+                       sc_pm_set_resource_power_mode(ipc_handle, SC_R_A72, SC_PM_PW_MODE_ON);
+
+               if (sc_pm_set_resource_power_mode(ipc_handle, ap_core_index[cpu_id + 4],
+                       SC_PM_PW_MODE_ON) != SC_ERR_NONE) {
+                       ERROR(" cluster1 core %d power on failed!\n", cpu_id);
+                       ret = PSCI_E_INTERN_FAIL;
+               }
+
+               if (sc_pm_cpu_start(ipc_handle, ap_core_index[cpu_id + 4],
+                       true, BL31_BASE) != SC_ERR_NONE) {
+                       ERROR("boot cluster1 core %d failed!\n", cpu_id);
+                       ret = PSCI_E_INTERN_FAIL;
+               }
+       }
+
+       return ret;
+}
+
+void imx_pwr_domain_on_finish(const psci_power_state_t *target_state)
+{
+       uint64_t mpidr = read_mpidr_el1();
+       unsigned int cluster_id = MPIDR_AFFLVL1_VAL(mpidr);
+
+       if (cluster_id == 0 && a53_cpu_on_number++ == 0)
+               cci_enable_snoop_dvm_reqs(0);
+       if (cluster_id == 1 && a72_cpu_on_number++ == 0)
+               cci_enable_snoop_dvm_reqs(1);
+
+       plat_gic_pcpu_init();
+       plat_gic_cpuif_enable();
+}
+
+int imx_validate_ns_entrypoint(uintptr_t ns_entrypoint)
+{
+       return PSCI_E_SUCCESS;
+}
+
+static const plat_psci_ops_t imx_plat_psci_ops = {
+       .pwr_domain_on = imx_pwr_domain_on,
+       .pwr_domain_on_finish = imx_pwr_domain_on_finish,
+       .validate_ns_entrypoint = imx_validate_ns_entrypoint,
+};
+
+int plat_setup_psci_ops(uintptr_t sec_entrypoint,
+                       const plat_psci_ops_t **psci_ops)
+{
+       uint64_t mpidr = read_mpidr_el1();
+       unsigned int cluster_id = MPIDR_AFFLVL1_VAL(mpidr);
+
+       imx_mailbox_init(sec_entrypoint);
+       *psci_ops = &imx_plat_psci_ops;
+
+       if (cluster_id == 0)
+               a53_cpu_on_number++;
+       else
+               a72_cpu_on_number++;
+
+       return 0;
+}
diff --git a/plat/imx/imx8qm/include/platform_def.h b/plat/imx/imx8qm/include/platform_def.h
new file mode 100644 (file)
index 0000000..51c2e1e
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#define PLATFORM_LINKER_FORMAT         "elf64-littleaarch64"
+#define PLATFORM_LINKER_ARCH           aarch64
+
+#define PLATFORM_STACK_SIZE            0X400
+#define CACHE_WRITEBACK_GRANULE                64
+
+#define PLAT_PRIMARY_CPU               0x0
+#define PLATFORM_MAX_CPU_PER_CLUSTER   4
+#define PLATFORM_CLUSTER_COUNT         2
+#define PLATFORM_CLUSTER0_CORE_COUNT   4
+#define PLATFORM_CLUSTER1_CORE_COUNT   2
+#define PLATFORM_CORE_COUNT            (PLATFORM_CLUSTER0_CORE_COUNT + \
+                                        PLATFORM_CLUSTER1_CORE_COUNT)
+
+#define IMX_PWR_LVL0                   MPIDR_AFFLVL0
+#define IMX_PWR_LVL1                   MPIDR_AFFLVL1
+#define IMX_PWR_LVL2                   MPIDR_AFFLVL2
+
+#define PWR_DOMAIN_AT_MAX_LVL          1
+#define PLAT_MAX_PWR_LVL               2
+#define PLAT_MAX_OFF_STATE             2
+#define PLAT_MAX_RET_STATE             1
+
+#define BL31_BASE                      0x80000000
+#define BL31_LIMIT                     0x80020000
+
+#define PLAT_GICD_BASE                 0x51a00000
+#define PLAT_GICD_SIZE                 0x10000
+#define PLAT_GICR_BASE                 0x51b00000
+#define PLAT_GICR_SIZE                 0xc0000
+#define PLAT_CCI_BASE                  0x52090000
+#define PLAT_CCI_SIZE                  0x10000
+#define CLUSTER0_CCI_SLVAE_IFACE       3
+#define CLUSTER1_CCI_SLVAE_IFACE       4
+#define IMX_BOOT_UART_BASE             0x5a060000
+#define IMX_BOOT_UART_SIZE             0x1000
+#define IMX_BOOT_UART_BAUDRATE         115200
+#define IMX_BOOT_UART_CLK_IN_HZ                24000000
+#define PLAT_CRASH_UART_BASE           IMX_BOOT_UART_BASE
+#define PLAT__CRASH_UART_CLK_IN_HZ     24000000
+#define IMX_CONSOLE_BAUDRATE           115200
+#define SC_IPC_BASE                    0x5d1b0000
+#define SC_IPC_SIZE                    0x10000
+
+#define COUNTER_FREQUENCY              8000000 /* 8MHz */
+
+/* non-secure uboot base */
+#define PLAT_NS_IMAGE_OFFSET           0x80020000
+
+#define PLAT_VIRT_ADDR_SPACE_SIZE      (1ull << 32)
+#define PLAT_PHY_ADDR_SPACE_SIZE       (1ull << 32)
+
+#define MAX_XLAT_TABLES                        8
+#define MAX_MMAP_REGIONS               12
+
+#define DEBUG_CONSOLE                  0
+#define DEBUG_CONSOLE_A53              0
+#define PLAT_IMX8QM                    1
diff --git a/plat/imx/imx8qm/include/sec_rsrc.h b/plat/imx/imx8qm/include/sec_rsrc.h
new file mode 100644 (file)
index 0000000..a623cd3
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* resources that are going to stay in secure partition */
+sc_rsrc_t secure_rsrcs[] = {
+       SC_R_MU_0A,
+       SC_R_A53,
+       SC_R_A53_0,
+       SC_R_A53_1,
+       SC_R_A53_2,
+       SC_R_A53_3,
+       SC_R_A72,
+       SC_R_A72_0,
+       SC_R_A72_1,
+       SC_R_GIC,
+       SC_R_GIC_SMMU,
+       SC_R_CCI,
+       SC_R_SYSTEM,
+       SC_R_IRQSTR_SCU2
+};
+
+/* resources that have register access for non-secure domain */
+sc_rsrc_t ns_access_allowed[] = {
+       SC_R_GIC,
+       SC_R_GIC_SMMU,
+       SC_R_CCI
+};
diff --git a/plat/imx/imx8qm/platform.mk b/plat/imx/imx8qm/platform.mk
new file mode 100644 (file)
index 0000000..c295e14
--- /dev/null
@@ -0,0 +1,40 @@
+#
+# Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+PLAT_INCLUDES          :=      -Iplat/imx/imx8qm/include               \
+                               -Iplat/imx/common/include               \
+
+IMX_GIC_SOURCES        :=              drivers/arm/gic/v3/gicv3_helpers.c      \
+                               drivers/arm/gic/v3/arm_gicv3_common.c   \
+                               drivers/arm/gic/v3/gic500.c             \
+                               drivers/arm/gic/v3/gicv3_main.c         \
+                               drivers/arm/gic/common/gic_common.c     \
+                               plat/common/plat_gicv3.c                \
+                               plat/common/plat_psci_common.c          \
+                               plat/imx/common/plat_imx8_gic.c
+
+BL31_SOURCES           +=      plat/imx/common/lpuart_console.S        \
+                               plat/imx/common/imx8_helpers.S          \
+                               plat/imx/imx8qm/imx8qm_bl31_setup.c     \
+                               plat/imx/imx8qm/imx8qm_psci.c           \
+                               plat/imx/common/imx8_topology.c         \
+                               lib/xlat_tables/aarch64/xlat_tables.c           \
+                               lib/xlat_tables/xlat_tables_common.c            \
+                               lib/cpus/aarch64/cortex_a53.S                   \
+                               lib/cpus/aarch64/cortex_a72.S                   \
+                               drivers/console/aarch64/console.S               \
+                               drivers/arm/cci/cci.c                           \
+                               ${IMX_GIC_SOURCES}                              \
+
+include plat/imx/common/sci/sci_api.mk
+
+ENABLE_PLAT_COMPAT     :=      0
+USE_COHERENT_MEM       :=      1
+RESET_TO_BL31          :=      1
+ARM_GIC_ARCH           :=      3
+A53_DISABLE_NON_TEMPORAL_HINT := 0
+MULTI_CONSOLE_API      :=      1
+ERRATA_A72_859971      :=      1